package com.axon.lemon
import java.awt.TexturePaintContext.Int;

import sun.font.Underline.IMGrayUnderline;

import grails.converters.JSON;

class ImageController {

    static scaffold=true
	
	def listImage(){
	print("day ne trong image "+params.placeID)	;
	 def IDplace=params.placeID
	 print(IDplace);
	 def placeI=Place.get(IDplace)
	 print(placeI)
	 def listimage= Image.findAllByPlace(placeI)
	 println("size" + listimage.size())
	 	for(int i=0; i<listimage.size() ; i++)
	 	 {
			 System.out.println(listimage[i].path);
		  }
	 render listimage as JSON;
}
	def showImage(){
		 def IDplace= params.placeID
		 int index = Integer.parseInt(params.index)
		 def placeI=Place.get(IDplace)
		 def listimage= Image.findAllByPlace(placeI)
		 response.outputStream << listimage.get(index).path
	}
}
/*
 def listAllComment(){
  
  //def subList = Comment.list();
  def placeTemp = Place.get(params.placeid)
  def listOfComment = placeTemp ? Comment.findAllByPlace(placeTemp) : []    
  print(listOfComment.size())
  for (int i = 0; i < listOfComment.size(); i++) {
 
   System.out.println(listOfComment[i].content+"  "+listOfComment[i].userprofile.fullName+"  "+listOfComment[i].place.address)
  }  
  render  listOfComment as JSON
 // return listOfComment
 }
 */